# config.py
import os


class Config:
    """配置文件"""

    # 数据配置
    RAW_DATA_DIR = "data/raw"
    PROCESSED_DATA_DIR = "data/processed"
    TEST_DATA_DIR = "data/test"
    MODEL_SAVE_DIR = "models"

    # 活动类别映射
    ACTIVITY_MAPPING = {
        'standing': 0,  # 静止
        'walking': 1,  # 走
        'running': 2,  # 跑
        'squatting': 3,  # 蹲下
        'falling': 4  # 摔倒
    }

    ACTIVITY_LABELS = {
        0: 'standing',
        1: 'walking',
        2: 'running',
        3: 'squatting',
        4: 'falling'
    }

    # 文件命名模式（用于自动分类）
    FILE_PATTERNS = {
        'standing': ['静止', 'standing', 'stand'],
        'walking': ['走', 'walking', 'walk'],
        'running': ['跑', 'running', 'run'],
        'squatting': ['蹲', 'squatting', 'squat'],
        'falling': ['摔倒', 'falling', 'fall']
    }

    # 数据参数 - 调整为适合小数据量
    SEQUENCE_LENGTH = 10  # 减少序列长度，适应您的数据量
    OVERLAP_RATIO = 0.8  # 增加重叠比例以生成更多序列
    SAMPLE_RATE = 50  # 采样频率
    MIN_SEQUENCE_LENGTH = 5  # 最小序列长度

    # 模型参数
    NUM_FEATURES = 3  # x_value, y_value, z_value
    NUM_CLASSES = 5  # 5种活动

    # 训练参数 - 调整为小数据量
    BATCH_SIZE = 8
    EPOCHS = 50
    LEARNING_RATE = 0.001
    VALIDATION_SPLIT = 0.3
    TEST_SPLIT = 0.2

    # 模型保存路径
    @classmethod
    def get_model_path(cls):
        os.makedirs(cls.MODEL_SAVE_DIR, exist_ok=True)
        return os.path.join(cls.MODEL_SAVE_DIR, "fall_detection_model.h5")

    @classmethod
    def get_preprocessor_path(cls):
        os.makedirs(cls.MODEL_SAVE_DIR, exist_ok=True)
        return os.path.join(cls.MODEL_SAVE_DIR, "preprocessor.pkl")